window.addEventListener("DOMContentLoaded", function() {

	let c1 = document.getElementById("c1");
	let v1 = document.getElementById("company-index-video");
	window.onpageshow = function() {
		c1.style.transform = "scale(1)";
		c1.style.opacity = "1";
	}
	let ctx1 = c1.getContext("2d");
	let [width, height] = [c1.width, c1.height];
	ctx1.drawImage(v1, 0, 0, width, height);

	v1.addEventListener('play', function() {

		(function run() {
			ctx1.drawImage(v1, 0, 0, width, height);
			this.i01 = setTimeout(run, 0);

		})();

	}, false);

	v1.addEventListener('pause', function() {
		clearInterval(this.i01);
	}, false);
	v1.addEventListener('ended', function() {
		clearInterval(this.i01);
		v1.play(); // 这里相当于设置了循环播放
	}, false);
});